package com.itheima.tlias84.mapper;

import com.itheima.tlias84.dto.ReportStudentDTO;
import com.itheima.tlias84.dto.SelectStudentDetailDTO;
import com.itheima.tlias84.dto.SelectViolationDTO;
import com.itheima.tlias84.po.InsertStudentParam;
import com.itheima.tlias84.dto.SelectStudentDTO;
import com.itheima.tlias84.entity.Student;
import com.itheima.tlias84.po.SelectStudentPageParam;
import com.itheima.tlias84.po.UpdateStudentParam;
import com.itheima.tlias84.po.UpdateVioStudentParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 学生 mapper：增删改查
 * GET：1、分页查询
 *      2、根据id查询
 *      3、批量导出
 * POST：1、添加学生
 *      2、批量导入
 * PUT：1、修改学生
 *      2、违纪处理
 * DELETE：批量删除学生
 */
@Mapper
public interface StudentMapper {
    /**
     * 查询所有学生
     * @return List<Student>
     */
    @Select("select * from student")
    List<Student> selectStudentAll();

    /**
     * 分页查询学生信息
     * @param param 查询条件
     * @return 结果
     */
    List<SelectStudentDTO> selectStudentByPage(@Param("p") SelectStudentPageParam param);

    int insertStudent(@Param("s") InsertStudentParam student);

    int updateStudent(@Param("s") UpdateStudentParam student);

    SelectStudentDetailDTO selectStudentById(@Param("id") Integer id);

    @Select("select id,violationCount,violationScore from student where id = #{id}")
    SelectViolationDTO selectStudentViolationById(@Param("id") Integer id);

    int updateStudentViolation(@Param("p")UpdateVioStudentParam param);


    int deleteStudentByIds(List<Integer> ids);

    List<ReportStudentDTO> countStudentDegree();


    List<ReportStudentDTO> countStudentClazz();
}
